!function(){

/*
	WebOS.init
	ʼ
*/
J.ready(function(){
	Panel_Body.init();
	Panel_Desktop.init();
	Panel_topbar.init();
	Panel_toolbar.init();
	Panel_Deskdiv.init();
	
	Panel_Body.addPanel(Panel_Desktop);
	Panel_Body.addPanel(Panel_topbar);
	Panel_Body.addPanel(Panel_toolbar);
	Panel_Desktop.addPanel(Panel_Deskdiv);
	Panel_Deskdiv
		.space({top:31,bottom:31})
		.refresh();
	
});/*
	WebOS.panel
	面板文件
*/

Panel_Body=function(me){
	return me={
		init:function(){
			me.create();
			me.setEvent();
		},
		create:function(){
			me.box=J('body').attr('id','Panel_Body');
		},
		setEvent:function(){
			
		},
		addPanel:function(panel){
			me.box.append(panel.box);
		}
	};
}();

Panel_Desktop=function(me){
	return me={
		init:function(){
			me.create();
			me.setEvent();
			me.background('#3165a8');
		},
		create:function(){
			me.box=J.node('<div id="Panel_Desktop"></div>');
		},
		setEvent:function(){
			me.box.on('contextmenu',function(e){
				e.stopPropagation();
				e.preventDefault();
				
				
			});
		},
		background:function(bgStyle){
			me.box.css('background',bgStyle);
		},
		addPanel:function(panel){
			me.box.append(panel.box);
		}
	};
}();
Panel_topbar=function(me){
	return me={
		init:function(){
			me.create();
			me.setEvent();
		},
		create:function(){
			me.box=J.node('<div id="Panel_topbar"></div>');
		},
		setEvent:function(){
		
		}
		
	};
}();
Panel_toolbar=function(me){
	return me={
		init:function(){
			me.create();
			me.setEvent();
		},
		create:function(){
			me.box=J.node('<div id="Panel_toolbar"></div>');
		},
		setEvent:function(){
		
		}
		
	};
}();
Panel_Deskdiv=function(me){
	return me={
		init:function(){
			me.create();
			me.setEvent();
		},
		create:function(){
			me.box=J.node('<div id="Panel_Deskdiv"></div>');
		},
		setEvent:function(){
			me.refreshCall=[];
			J(window).on('resize',function(){
				me.refresh();
			});
		},
		onrefresh:function(callback){
			me.refreshCall.push(callback);
		},
		refresh:function(){
			J.each(me.refreshCall,function(){
				this();
			});
			return me;
		},
		space:function(ops){
			('top' in ops)&&this.box.top(ops.top);
			('right' in ops)&&this.box.css('right',ops.right);
			('bottom' in ops)&&this.box.css('bottom',ops.bottom);
			('left' in ops)&&this.box.left(ops.left);
			return me;
		},
		end:0
		
	};
}();



}();